package br.com.kliptus.model.bean;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.maverick.bean.EntityBean;

@Entity
@Table(name = "item_service_order")
public class ItemOrderJB extends EntityBean {

	private static final long serialVersionUID = 1L;
	
	private ServiceOrderJB serviceOrder;
	private ProductJB product;
	private Integer quantity;
	private Double unitValue;
	
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
	public Long getId() {
		return id;
	}

	@ManyToOne(cascade=CascadeType.ALL)
	@JoinColumn(name = "service_order_id", referencedColumnName = "id")
	public ServiceOrderJB getServiceOrder() {
		return serviceOrder;
	}

	public void setServiceOrder(ServiceOrderJB serviceOrder) {
		this.serviceOrder = serviceOrder;
	}

	@ManyToOne
	@JoinColumn(name = "product_id", referencedColumnName = "id")
	public ProductJB getProduct() {
		return product;
	}

	public void setProduct(ProductJB product) {
		this.product = product;
	}

	@Column(name = "quantity")
	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	@Column(name = "unit_value")
	public Double getUnitValue() {
		return unitValue;
	}

	public void setUnitValue(Double unitValue) {
		this.unitValue = unitValue;
	}

}